import java.awt.Dimension;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;

public class Button extends JLayeredPane{
	
	private static final long serialVersionUID = 1L;
	JLabel label;
	JLabel background;
	int x, y;
    
	Button(int x, int y, MapNode node){
		this.x = x;
		this.y = y;
		setLayout(null);
		if(node.type == TerrainType.Lake)
			background = new JLabel("", new ImageIcon(getClass().getResource("/Pics/lake3.gif")) , JLabel.CENTER);
		else if(node.type == TerrainType.Sand)
			background = new JLabel("", new ImageIcon(getClass().getResource("/Pics/sand2.gif")) , JLabel.CENTER);
		else
			background = new JLabel("", new ImageIcon(getClass().getResource("/Pics/field3.gif")) , JLabel.CENTER);
		
		label = new JLabel("", new ImageIcon(getClass().getResource("/Pics/button.gif")) , JLabel.CENTER);
		add(label,  new Integer(1));
		add(background, new Integer(0));
		background.setBounds(0, 0, 24, 24);
		label.setBounds(0, 0, 24, 24);
		setSize(24,24);
	}
	@Override
	public Dimension getMinimumSize(){
		return new Dimension(24,24);	
	}
	@Override
	public Dimension getMaximumSize(){
		return new Dimension(24,24);	
	}
	@Override
	public Dimension getPreferredSize(){
		return new Dimension(24,24);	
	}
	
	public String toString(){
		
		return "Knapp";
	}
	
}
